﻿Public Class Task
    Dim _series As RTMnet.TaskSeries
    Dim _listId As String
    Public ReadOnly Property ListId() As String
        Get
            Return _listId
        End Get
    End Property

    'Shared _lists As RTMnet.Lists

    'Shared ReadOnly Property Lists() As RTMnet.Lists
    '    Get
    '        If IsNothing(_lists) Then
    '            Dim rtm = New RTMnet.RTM(My.Settings.ApiKey, sharedsecret, My.Settings.Token)
    '            _lists = rtm.ListsGetList()
    '        End If
    '        Return _lists
    '    End Get
    'End Property

    Public ReadOnly Property Name() As String
        Get
            Return Series.Name

        End Get
    End Property

    Public ReadOnly Property Due() As Date
        Get
            If Series.TaskInfo(0).Due = Date.MinValue Then
                Return Date.MaxValue
            End If
            Return Series.TaskInfo(0).Due
        End Get
    End Property

    'Dim _listname As String = String.Empty
    'Public ReadOnly Property ListName() As String
    '    Get
    '        If String.IsNullOrEmpty(_listname) Then
    '            'Dim lists = rtm.ListsGetList()
    '            Dim query = From list In Lists.ListCollection Where list.ID = ListId Select list.Name
    '            If query.Count > 0 Then _listname = query(0) Else _listname = "[no list]"
    '        End If
    '        Return _listname
    '    End Get
    'End Property

    Public ReadOnly Property Series() As RTMnet.TaskSeries
        Get
            Return _series
        End Get
    End Property
    Public Sub New(ByVal aSeries As RTMnet.TaskSeries, ByVal listId As String)
        Me._series = aSeries
        Me._listId = listId
    End Sub
End Class